"""所有全局变量存放入 global_dict 字典中，可以在不同的模块中使用相同的全局变量"""
global_dict = {
    'sustain_fire': False, # 设置持续发射子弹标志，默认为False
    'show_start_screen': True, # 设置是否展示开始屏幕，默认为True
    'running': False, # 设置是否开始游戏，默认为False
    'show_about_screen': False, # 设置是否展示关于屏幕，默认为False
    'game_state': ('living', 'paused', 'dead'),
    'current_game_state': 'living' # 设置当前游戏状态，默认为'living'

}


def get_value(key):
    return global_dict.get(key)


def set_value(key, value):
    global_dict[key] = value


def get_game_state():
    return global_dict.get('current_game_state')


def set_game_state(state):
    if state in global_dict.get('game_state'):
        global_dict['current_game_state'] = state